package com.company.cloud.captcha.modules.service.impl;

import org.springframework.beans.factory.annotation.Autowired;

import com.company.cloud.captcha.modules.service.CaptchaCacheService;
import com.company.cloud.common.redis.service.RedisUtils;

public class CaptchaCacheServiceMemImpl implements CaptchaCacheService {
    @Autowired
    private RedisUtils redisUtils;

    @Override
    public void set(String key, String value, long expiresInSeconds) {
        redisUtils.set(key, value, expiresInSeconds);
        //CacheUtil.set(key, value, expiresInSeconds);
    }

    @Override
    public boolean exists(String key) {
        return redisUtils.hasKey(key);
        //return CacheUtil.exists(key);
    }

    @Override
    public void delete(String key) {
        redisUtils.delete(key);
        //CacheUtil.delete(key);
    }

    @Override
    public String get(String key) {
        return redisUtils.get(key);
        //return CacheUtil.get(key);
    }

    @Override
    public String type() {
        return "local";
    }
}
